<template>
<div>
  <input :type="type" :value="value" @input="inputValue" v-bind="$attrs" />
</div>
</template>

<script>
import emitter from '../utils/emitter'
export default {
  mixins: [emitter],
  props: {
    type: {
      type: String,
      default: "text",
    },
    value: {
      type: String,
      default: "",
    },
  },
  methods: {
    inputValue(e) {
      this.$emit("input", e.target.value);

      // 通知父级执行校验 （查看源码解决parents children 等问题）
      // this.$parent.$emit('validate')
      this.dispatch('KFormItem', 'kform.change', [e]);
    },
  },
};
</script>

<style>
</style>
